Class HCC.DT.HCC2HL72.NewDocRegRequest Extends Ens.DataTransformDTL [ DependsOn = (EnsLib.EDI.XML.Document, EnsLib.HL7.Message) ]
{

Parameter IGNOREMISSINGSOURCE = 1;

Parameter REPORTERRORS = 1;

Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='EnsLib.EDI.XML.Document' targetClass='EnsLib.HL7.Message' sourceDocType='RCMR_IN000002UV02:RCMR_IN000002UV02' targetDocType='2.5.1:MDM_T02' create='new' language='objectscript' >
<assign value='source.{id().extension}' property='target.{MSH:MessageControlID}' action='set' />
<assign value='source.{creationTime().value}' property='target.{MSH:DateTimeOfMessage.Time}' action='set' />
<assign value='"MDM"' property='target.{MSH:MessageType.MessageCode}' action='set' />
<assign value='"T02"' property='target.{MSH:MessageType.TriggerEvent}' action='set' />
<assign value='source.{controlActProcess().subject().clinicalDocument().recordTarget().patient().id().item().extension}' property='target.{PID:PatientID.IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().clinicalDocument().recordTarget().patient().choice.patientPerson().id().item().extension}' property='target.{PID:PatientIdentifierList(1).IDNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().clinicalDocument().recordTarget().patient().choice.patientPerson().name()},"//s:item/s:part/@value")' property='target.{PID:PatientName(1)}' action='set' />
<assign value='source.{controlActProcess().subject().clinicalDocument().recordTarget().patient().effectiveTime.low.value}' property='target.{EVN:RecordedDateTime.Time}' action='set' />
<assign value='source.{controlActProcess().subject().clinicalDocument().code().displayName.value}' property='target.{TXA:DocumentType}' action='set' />
<assign value='source.{controlActProcess().subject().clinicalDocument().effectiveTime().value}' property='target.{TXA:OriginationDateTime}' action='set' />
<assign value='source.{controlActProcess().subject().clinicalDocument().confidentialityCode().displayName.value}' property='target.{TXA:DocumentConfidentialityStatu}' action='set' />
<assign value='source.{controlActProcess().subject().clinicalDocument().storageCode.originalText.value}' property='target.{TXA:DocumentStorageStatus}' action='set' />
<assign value='source.{controlActProcess().subject().clinicalDocument().versionNumber.value}' property='target.{TXA:UniqueDocumentNumber}' action='set' />
<assign value='source.{controlActProcess().subject().clinicalDocument().id().item().extension}' property='target.{TXA:SetIDTXA}' action='set' />
<assign value='source.{controlActProcess().subject().clinicalDocument().author().assignedAuthor().id().item().extension}' property='target.{TXA:OriginatorCodeName(1).IDNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().clinicalDocument().author().assignedAuthor().choice.assignedPerson.name()},"//s:item/s:part/@value")' property='target.{TXA:OriginatorCodeName().FamilyName}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().clinicalDocument().recordTarget().patient().providerOrganization.name},"//s:item/s:part/@value")' property='target.{OBXgrp(1).OBX:PerformingOrganizationName.OrganizationName}' action='set' />
<assign value='source.{controlActProcess().subject().clinicalDocument().recordTarget().patient().providerOrganization.id().item().extension}' property='target.{OBXgrp().OBX:PerformingOrganizationName.IDNumber}' action='set' />
<assign value='source.{controlActProcess().subject().clinicalDocument().recordTarget().patient().providerOrganization.organizationContains().id.item().extension}' property='target.{OBXgrp().OBX:PerformingOrganizationName.OrganizationIdentifier}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().clinicalDocument().custodian().assignedCustodian().representedOrganization().name},"//s:item/s:part/@value")' property='target.{PV1:ServicingFacility}' action='set' />
</transform>
}

}
